package cn.com.bluemoon.daps.api.model;

import cn.com.bluemoon.daps.api.model.factory.RemoteDataModelTableFieldServiceFallbackFactory;
import cn.com.bluemoon.daps.common.constant.ServiceNameConstants.DapsApiModel;
import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.model.entity.DapDataModelTableField;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @author Jarod.Kong
 * @date 2020/12/22 9:08
 */
@FeignClient(value = DapsApiModel.SERVICE, fallbackFactory = RemoteDataModelTableFieldServiceFallbackFactory.class)
@RequestMapping(DapsApiModel.BASE_URI + DapsApiModel.API_MODEL_FIELD)
@ApiIgnore
public interface RemoteDataModelTableFieldService {

    @PutMapping("/clean")
    public ResultBean<String> cleanRelation(@RequestParam("standardUniqueId")
                                            @ApiParam("标准唯一id") String standardUniqueId);

    @PostMapping("/updateField")
    @ApiOperation("变更表字段信息")
    public ResultBean<Boolean> updateSetById(@RequestParam("fieldId") String id,
                                             @RequestBody DapDataModelTableField newT);

    @PostMapping("deleteOrUpdateById")
    @ApiOperation("删除字段或者逻辑删除")
    ResultBean<Boolean> dropById(@RequestBody DapDataModelTableField oldT,
                                 @RequestParam("del") boolean logicDelete);


    @PostMapping("saveField")
    @ApiOperation("新增字段")
    ResultBean<String> saveField(@RequestBody DapDataModelTableField newT);
}
